package com.zb.service.impl;

import com.zb.dao.NewsDetailDao;
import com.zb.entity.NewsDetail;
import com.zb.service.NewsDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by 11965 on 2019/7/8.
 */
@Service
public class NewsDetailServiceImpl implements NewsDetailService {

    @Autowired
    private NewsDetailDao newsDetailDao;

    @Transactional(readOnly = true)
    @Override
    public List<NewsDetail> listAll() {
        return newsDetailDao.listAll();
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int addNews(NewsDetail n) {
        return newsDetailDao.addNews(n);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int deleteNews(int id) {
        return newsDetailDao.deleteNews(id);
    }
    @Transactional(readOnly = true)
    @Override
    public NewsDetail findById(int id) {
        return newsDetailDao.findById(id);
    }

    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int updateNews(NewsDetail n) {
        return newsDetailDao.updateNews(n);
    }
}
